package com.windoent.yugioh.widget;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.windoent.yugioh.R;

/**
 * author : robert
 * date   : 2021/4/28 11:23
 * desc   :
 */
public class ContactUsItem extends RelativeLayout {
    private Context mConText;
    private LinearLayout mLlParent;
    private TextView mTvTitle;
    private TextView mTvContent;


    private String title;
    private String tvhint;


    public ContactUsItem(Context context) {
        this(context, null, 0);
    }

    public ContactUsItem(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public ContactUsItem(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        this.mConText = context;
        LayoutInflater.from(mConText).inflate(R.layout.custom_view_contact_us, this);
        TypedArray attributes = mConText.obtainStyledAttributes(attrs, R.styleable.UserInfoItem, 0, 0);
        try {
            title = attributes.getString(R.styleable.UserInfoItem_title);
            tvhint = attributes.getString(R.styleable.UserInfoItem_tvhint);
        } finally {
            attributes.recycle();
        }
        setUpView();
    }

    private void setUpView() {

        mLlParent = (LinearLayout) findViewById(R.id.ll_parent);
        mTvTitle = (TextView) findViewById(R.id.tv_title);
        mTvContent = (TextView) findViewById(R.id.tv_content);

        mTvTitle.setText(title);
        mTvContent.setText(tvhint);
    }

    public String getTvContent() {
        return mTvContent.getText().toString().trim();
    }

    public TextView getTextView() {
        return mTvContent;
    }

    public void setItemListener(OnClickListener listener) {
        mLlParent.setOnClickListener(listener);
    }
}

